// src/router/index.ts
import {createRouter, createWebHistory, RouteRecordRaw} from 'vue-router'
import HomeView from '../views/HomeView.vue'

const routes: Array<RouteRecordRaw> = [
    {
        path: '/',
        component: HomeView,
        redirect: '/admin/users',
        children: [
            {
                path: 'admin/users',
                component: () => import('../views/admin/AdminUsers.vue')
            },
            {
                path: 'admin/companies',
                component: () => import('../views/admin/AdminCompanies.vue')
            },
            {
                path: 'admin/jobs',
                component: () => import('../views/admin/AdminJobs.vue')
            },
            {
                path: 'admin/skill',
                component: () => import('../views/admin/AdminJobSkills.vue')
            },
            {
                path: 'admin/resumes',
                component: () => import('../views/admin/AdminResumes.vue')
            },
            {
                path: 'admin/application',
                component: () => import('../views/admin/AdminApplications.vue')
            },
            {
                path: 'admin/messages',
                component: () => import('../views/admin/AdminMessages.vue')
            },
            {
                path: 'admin/favorite',
                component: () => import('../views/admin/AdminFavorites.vue')
            },
            {
                path: 'admin/history',
                component: () => import('../views/admin/AdminSearchHistory.vue')
            }
            ]},
    {
        path: '/about',
        name: 'about',
        // route level code-splitting
        // this generates a separate chunk (about.[hash].js) for this route
        // which is lazy-loaded when the route is visited.
        component: () => import(/* webpackChunkName: "about" */ '../views/AboutView.vue')
    }, {
        path: '/admin/users',
        name: 'AdminUsers',
        component: () => import('../views/admin/AdminUsers.vue')
    }, {
        path: '/admin/companies',
        name: 'AdminCompanies',
        component: () => import('../views/admin/AdminCompanies.vue')
    }, {
        path: '/admin/jobs',
        name: 'AdminJobs',
        component: () => import('../views/admin/AdminJobs.vue')
    },

]

const router = createRouter({
    history: createWebHistory(process.env.BASE_URL || '/'),
    routes
})

export default router
